﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using DeyuMvc.Dbs;

namespace DeyuMvc.Models
{
    public class Students
    {
        [Key]
        [DisplayName("学号")]
        [MaxLength(45, ErrorMessage="学号长度不能超过45")]
        public string StuCode { get; set; }

        [DisplayName("学生姓名")]
        [MaxLength(45,ErrorMessage = "学生姓名不能超过30个字符")]
        [Required(ErrorMessage = "请填学生姓名")]
        public string StuName { get; set; }

        [DisplayName("年龄")]
        public int Age { get; set; }

        [DisplayName("出生日期")]
        [Required(ErrorMessage = "请填写出生日期")]
        public DateTime Birthdate { get; set; }

    }

    public class StudentsBll : DBCommon<Students>
    {
        public override string TableName
        {
            get { return "dy_students"; }
        }

        public override string PrimaryKey
        {
            get { return "StuCode"; }
        }

        public override string ConnKey
        {
            get { return "default"; }
        }

        public override string ParaF
        {
            get { return "@"; }
        }
    }
}